//定义控制器
		app.controller('brandController',function($scope,$controller,brandService){
			
			$controller('baseController',{$scope:$scope});
			
			//n多的方法
			$scope.findAll=function(){
				brandService.findAll().success(
					function(response){
						$scope.list=response;
					}		
				);
			}
			
		
			//分页
			$scope.findPage=function(page,size){
				brandService.findPage(page,size).success(
					function(response){
						$scope.list=response.rows;
						$scope.paginationConf.totalItems=response.total;
					}
				);
			}
			//增加or修改品牌
			$scope.save=function(){
				var object =null;
				if($scope.entity.id!=null){
					object=brandService.update($scope.entity);
				}else{
					object=brandService.add($scope.entity);
				}
				object.success(
						function(response){
							if(response.success){
								//成功,重新加载
								$scope.reloadList();
							}else{
								//失败,弹出信息
								alert(response.message)
							}
						}
					);
			}
			
			//修改品牌
			$scope.findOne=function(id){
				brandService.findOne(id).success(
					function(response){
						$scope.entity=response;
					}		
				)
			}
			
			
			
			//批量删除
			$scope.dele=function(){
				if(confirm("确定删除?")){
					brandService.dele($scope.selectIds).success(
						
						function(response){
							if(response.success){
								//成功,重新加载
								$scope.reloadList();
								$scope.selectIds=[];
							}else{
								//失败,弹出信息
								alert(response.message)
							}	
						}
					)
				}
			}
			//根据条件查询
			$scope.serchEntity={};
			
			$scope.serch=function(page,size){
				brandService.serch(page,size,$scope.serchEntity).success(
						function(response){
							$scope.list=response.rows;
							$scope.paginationConf.totalItems=response.total;
						}
					);
			}
			
			
		});
	